<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1"/>
    <meta http-equiv="X-UA-Compatible" content="IE=9"/>
    <link rel="stylesheet" href="../../../lib/layui/css/layui.css">
    <link rel="stylesheet" href="../../static/css/common.css">
    <link rel="stylesheet" href="../../static/css/settings.css">
    <title>马达基本信息设置</title>
</head>
<body>
<!--头部-->
<!--<header class="tophead" id="headerWrap"></header>-->
<!--主体-->
<div class="mainbody">
    <h3>马达基本信息设置</h3>
    <!--表格-->
    <div class="tables">
        <table lay-filter="setMotorsTable" class="settingTable" lay-data="{id: 'motorsInfo'}"></table>
    </div>
</div>

<!--新增按钮-->
<script type="text/html" id="toolbarMotors">
    <div class="layui-btn-container">
        <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="addMotors">新增</button>
    </div>
</script>
<!--新增弹框-->
<script type="text/html" id="newAdd">
    <div class="options">
        <form class="layui-form addInfos" lay-filter="AddForm" action="#">
            <div class="infowrap">
                <div class="layui-form-item">
                    <label class="layui-form-label">区域</label>
                    <div class="layui-input-inline">
                        <select class="layui-input layui-bg-blue areaMenu" name="areaId"
                                lay-filter="areaMenu"></select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">马达名称</label>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" name="moName">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">上限</label>
                    <div class="layui-input-inline limit-box">
                        <input type="checkbox" name="switch" lay-skin="switch" lay-text="启用|禁用"
                               lay-filter="switchLimit" class="upperLimitSwitch">
                        <input type="text" class="layui-input layui-hide" placeholder="请输入" name="upperLimit">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">下限</label>
                    <div class="layui-input-inline limit-box">
                        <input type="checkbox" name="switch" lay-skin="switch" lay-text="启用|禁用"
                               lay-filter="switchLimit">
                        <input type="text" class="layui-input layui-hide" placeholder="请输入" name="lowerLimit">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">管制上限</label>
                    <div class="layui-input-inline limit-box">
                        <input type="checkbox" name="switch-upperLimitInner" lay-skin="switch" lay-text="启用|禁用"
                               lay-filter="switchLimitEdit" class="upperLimitSwitch">
                        <input type="text" class="layui-input layui-hide" placeholder="请输入" name="upperLimitInner">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">管制下限</label>
                    <div class="layui-input-inline limit-box">
                        <input type="checkbox" name="switch-lowerLimitInner" lay-skin="switch" lay-text="启用|禁用"
                               lay-filter="switchLimitEdit">
                        <input type="text" class="layui-input layui-hide" placeholder="请输入" name="lowerLimitInner">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">马达期别</label>
                    <div class="layui-input-inline">
                        <select class="layui-input layui-bg-blue side-type" name="periods" lay-filter="addSideType">
                            <option value="1">一期</option>
                            <option value="2" selected>二期</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-inline">
                        <textarea name="notes" placeholder="请输入内容" class="layui-textarea"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="fr">
                        <button class="layui-btn layui-btn-sm submitBtn" lay-submit lay-filter="AddForm">确定</button>
                        <button type="cancel" class="layui-btn layui-btn-sm layui-btn-primary">取消</button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</script>
<!--行操作-->
<script type="text/html" id="rowOperate">
    <div class=" layui-btn-group">
        <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
        {{#      if (d.monitorId == null){      }}
        <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="install">安装监测器</a>
        {{#      }else{       }}
        <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="uninstall">卸载监测器</a>
        {{# } }}
    </div>
</script>
<!--行编辑弹窗-->
<script type="text/html" id="rowEdit">
    <div class="options">
        <form class="layui-form editInfos" lay-filter="rowEditForm" action="#">
            <div class="infowrap">
                <input type="hidden" name="moId">
                <div class="layui-form-item">
                    <label class="layui-form-label">区域</label>
                    <div class="layui-input-inline">
                        <select class="layui-input layui-bg-blue areaMenu" name="areaId"
                                lay-filter="areaMenu2"></select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">马达名称</label>
                    <div class="layui-input-inline">
                        <input type="text" value="" class="layui-input" name="moName">
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">上限</label>
                    <div class="layui-input-inline limit-box">
                        <input type="checkbox" name="switch-upperLimit" lay-skin="switch" lay-text="启用|禁用"
                               lay-filter="switchLimitEdit" class="upperLimitSwitch">
                        <input type="text" class="layui-input layui-hide" placeholder="请输入" name="upperLimit">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">下限</label>
                    <div class="layui-input-inline limit-box">
                        <input type="checkbox" name="switch-lowerLimit" lay-skin="switch" lay-text="启用|禁用"
                               lay-filter="switchLimitEdit">
                        <input type="text" class="layui-input layui-hide" placeholder="请输入" name="lowerLimit">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">管制上限</label>
                    <div class="layui-input-inline limit-box">
                        <input type="checkbox" name="switch-upperLimitInner" lay-skin="switch" lay-text="启用|禁用"
                               lay-filter="switchLimitEdit" class="upperLimitSwitch">
                        <input type="text" class="layui-input layui-hide" placeholder="请输入" name="upperLimitInner">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">管制下限</label>
                    <div class="layui-input-inline limit-box">
                        <input type="checkbox" name="switch-lowerLimitInner" lay-skin="switch" lay-text="启用|禁用"
                               lay-filter="switchLimitEdit">
                        <input type="text" class="layui-input layui-hide" placeholder="请输入" name="lowerLimitInner">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">马达期别</label>
                    <div class="layui-input-inline">
                        <select class="layui-input layui-bg-blue side-type" name="periods" lay-filter="addSideType">
                            <option value="1">一期</option>
                            <option value="2">二期</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-inline">
                        <textarea name="notes" placeholder="请输入内容" class="layui-textarea"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="fr">
                        <button class="layui-btn layui-btn-sm" lay-submit lay-filter="rowEditForm">确定</button>
                        <button type="cancel" class="layui-btn layui-btn-sm layui-btn-primary">取消</button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</script>
<!--安装监测器弹窗-->
<script type="text/html" id="installMonitor">
    <div class="options">
        <form class="layui-form installForm" lay-filter="installMonitorForm" action="#">
            <div class="infowrap">
                <div class="layui-form-item">
                    <input type="hidden" name="moId" />
                    <label class="layui-form-label">监测器</label>
                    <div class="layui-input-inline">
                        <select class="layui-input layui-bg-blue monitors" name="monitorId"
                                lay-filter="monitors"></select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="fr">
                        <button class="layui-btn layui-btn-sm" lay-submit lay-filter="installMonitorForm">确定</button>
                        <button type="cancel" class="layui-btn layui-btn-sm layui-btn-primary">取消</button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</script>
<!--区域模板-->
<script type="text/html" id="motor-areas-tpl">
    <option value="0">请选择</option>
    {{each data}}
    <option value="{{$value.areaId}}">{{$value.areaName}}</option>
    {{/each}}
</script>
<!-- 监测器模板 -->
<script type="text/html" id="install-tpl">
    {{each data}}
    <option value="{{$value.monitorId}}">地址{{$value.converterAddr}}-第{{$value.bitSn}}个信号位-量程[{{$value.valueFrom}}-{{$value.valueTo}}]</option>
    {{/each}}
</script>
</body>
</html>
<script src="../../../lib/layui/layui.js"></script>
<script src="../../static/js/common.js"></script>
<script src="../../static/js/file/motors-setting.js"></script>
